#include<stdio.h>
#include<sys/stat.h>
#include<sys/types.h>
#include<fcntl.h>
#include<stdlib.h>
#include<unistd.h>

int main(int argc,char **argv)
{
	if(argc!=2){
		printf("Usage:%s filepath\n",argv[0]);
		return -1;
	}
	
	int fd = open(argv[1],O_RDONLY);
	if(fd==-1){
		perror("open");
		return -1;
	}

	printf("filesize = %d\n",lseek(fd,0,SEEK_END));

	close(fd);
	return 0;
}